/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */
class Solution {
public:
    void reversePush(vector<int>& res,ListNode* head)
    {
        if(head==nullptr)
        {
            return;
        }
        reversePush( res,head->next);
        res.push_back(head->val);
    }
    vector<int> reversePrint(ListNode* head) {
        //递归方式
        vector<int>res;
        reversePush(res,head);
        return res;
    }
};